package com.social.socialservice.controller;

import com.social.socialservice.dal.NotifyDAL;
import com.social.socialservice.model.NotifyInfo;
import com.social.socialservice.unit.Pager;
import com.social.socialservice.unit.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 通知消息API
 */
@RestController
@CrossOrigin
public class NotifyController {
    @Autowired
    NotifyDAL notifyDAL;

    /**
     * getNotifyMapperDataByCurrentUserId
     * 查询消息分页
     * 通过当前用户id进行查询
     */
    @RequestMapping(value = "/getNotifyMapperDataByCurrentUserId", method = RequestMethod.POST, produces = "application/json; utf-8")
    public Response getNotifyMapperDataByCurrentUserId(@RequestBody Pager pager) {
        return notifyDAL.getNotifyMapperDataByCurrentUserId(pager);
    }

    /**
     * getNotifyMapperDataATCurrentUserId
     * 消息提示中提及@用户的消息数据
     */
    @RequestMapping(value = "/getNotifyMapperDataATCurrentUserId", method = RequestMethod.POST, produces = "application/json; utf-8")
    public Response getNotifyMapperDataATCurrentUserId(@RequestBody Pager pager) {
        return notifyDAL.getNotifyMapperDataATCurrentUserId(pager);
    }

    /**
     * getNotifyMapperDataHDCurrentUserId
     * 互动消息指的是点赞和关注
     */
    @RequestMapping(value = "/getNotifyMapperDataHDCurrentUserId", method = RequestMethod.POST, produces = "application/json; utf-8")
    public Response getNotifyMapperDataHDCurrentUserId(@RequestBody Pager pager) {
        return notifyDAL.getNotifyMapperDataHDCurrentUserId(pager);
    }

    /**
     * 检索未读的通知消息数量
     */
    @RequestMapping(value = "/getNotifyNotRead", method = RequestMethod.POST, produces = "application/json; utf-8")
    public Response getNotifyNotRead(@RequestBody NotifyInfo notifyInfo) {
        return notifyDAL.getNotifyNotRead(notifyInfo);
    }
}
